package homework31;

public class ResourceManager {
    // 静态私有实例变量
    private static ResourceManager instance;
    // 资源计数器（静态变量，属于类）
    private static int resourceCounter = 0;

    // 私有构造器
    private ResourceManager() {}

    // 静态公有访问方法（线程不安全版本）
    public static ResourceManager getInstance() {
        if (instance == null) {
            instance = new ResourceManager();
        }
        return instance;
    }

    // 获取唯一资源标识符
    public int getResource() {
        return ++resourceCounter;
    }
}
